/**
 * \* Created with IntelliJ IDEA.
 * \* User: 冯若航
 * \* Date: 2021/5/2
 * \* Time: 12:44
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class 二叉树镜像 {
    public class TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode(int x) { val = x; }
    }

    public TreeNode mirrorTree(TreeNode root) {
        if(root == null) {
            return null;
        }

        TreeNode tmp=mirrorTree(root.left);
        root.left=mirrorTree(root.right);
        root.right=tmp;
        return root;
    }


}
